/**
 * 
 */
package com.easidea.tim.entity.finance;

import java.util.Date;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.springside.core.dao.extend.Undeletable;

import com.easidea.tim.entity.BaseEntity;
import com.easidea.tim.entity.purchase.PurchaseOrder;

/**
 * @author Harrison
 *
 */
@Entity(name = "tim_finance_shouldpay")
@org.hibernate.annotations.Entity(dynamicInsert = true, dynamicUpdate = true)
@Undeletable(status = "deleted")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE, region = "tim_finance_shouldpay")
public class ShouldPay extends BaseEntity {

    /**
	 * 
	 */
	private static final long serialVersionUID = -8632486606493596267L;
	
	
	public static final Short SHOULD_PAY_STATUS_NOT_PAY = 0;
    public static final Short SHOULD_PAY_STATUS_PAYED = 1;

    private Double billAmount;
    private String billCause;
    private Date billDate;
    private List<ShouldPayCleanRecord> payCleanRecords;
   // private FinanceItem item;
    private ShouldPaySummary shouldPaySummary;
    private PurchaseOrder order;
    private Double checkInAmount; //入库金额
    private Date checkInDate; //入库时间
    private String checkInFlowNo; //入库记录编号
	
    @OneToOne(cascade = CascadeType.PERSIST)
    @JoinColumn(name="purchase_order_id")    
    public PurchaseOrder getOrder() {
		return order;
	}

	public void setOrder(PurchaseOrder order) {
		this.order = order;
	}

	/**
     * @return the billAmount
     */
    @Column(name = "bill_amount", columnDefinition = "numeric(13,2)")
    public Double getBillAmount() {
        return billAmount;
    }

    /**
     * @param billAmount the billAmount to set
     */
    public void setBillAmount(Double billAmount) {
        this.billAmount = billAmount;
    }

    /**
     * @return the billCause
     */
    @Column(name = "bill_cause")
    public String getBillCause() {
        return billCause;
    }

    /**
     * @param billCause the billCause to set
     */
    public void setBillCause(String billCause) {
        this.billCause = billCause;
    }

    /**
     * @return the billDate
     */
    @Column(name = "bill_date")
    @Temporal(TemporalType.DATE)
    public Date getBillDate() {
        return billDate;
    }

    /**
     * @param billDate the billDate to set
     */
    public void setBillDate(Date billDate) {
        this.billDate = billDate;
    }


	/**
	 * @return the item
	 */
//    @ManyToOne(fetch=FetchType.LAZY)
//    @JoinColumn(name="finance_item_id", nullable=false)
//	public FinanceItem getItem() {
//		return item;
//	}
//
//	/**
//	 * @param item the item to set
//	 */
//	public void setItem(FinanceItem item) {
//		this.item = item;
//	}
	@ManyToOne(fetch=FetchType.LAZY)
	@JoinColumn(name="shouldPaySummary_id", nullable=false)
	public ShouldPaySummary getShouldPaySummary() {
		return shouldPaySummary;
	}

	public void setShouldPaySummary(ShouldPaySummary shouldPaySummary) {
		this.shouldPaySummary = shouldPaySummary;
	}
	@OneToMany(fetch=FetchType.LAZY, mappedBy="shouldPay")
	public List<ShouldPayCleanRecord> getPayCleanRecords() {
		return payCleanRecords;
	}

	public void setPayCleanRecords(List<ShouldPayCleanRecord> payCleanRecords) {
		this.payCleanRecords = payCleanRecords;
	}

	/**
	 * @return the checkInAmount
	 */
	@Column(name="check_in_amount",columnDefinition="decimal(18,3)")
	public Double getCheckInAmount() {
		return checkInAmount;
	}

	/**
	 * @param checkInAmount the checkInAmount to set
	 */
	public void setCheckInAmount(Double checkInAmount) {
		this.checkInAmount = checkInAmount;
	}

	/**
	 * @return the checkInDate
	 */
	@Column(name="check_in_date")
	public Date getCheckInDate() {
		return checkInDate;
	}

	/**
	 * @param checkInDate the checkInDate to set
	 */
	public void setCheckInDate(Date checkInDate) {
		this.checkInDate = checkInDate;
	}

	/**
	 * @return the checkInFlowNo
	 */
	@Column(name="check_in_flow_no")
	public String getCheckInFlowNo() {
		return checkInFlowNo;
	}

	/**
	 * @param checkInFlowNo the checkInFlowNo to set
	 */
	public void setCheckInFlowNo(String checkInFlowNo) {
		this.checkInFlowNo = checkInFlowNo;
	}
	
}
